package com.dkd.flow.emums;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonValue;

public enum RuleType implements IEnum<String> {
    CONDITIONS_RULE("conditions", "其他字段条件规则"),
    EMPTY_RULE("empty", "空条件"),
    INITIATOR_RULE("initiator", "以发起人为条件");
    @EnumValue
    public final String value;
    public final String name;
    RuleType(String value, String name) {
        this.value = value;
        this.name = name;
    }
    @Override
    @JsonValue
    public String getValue() {
        return value;
    }
    public String getName() {
        return name;
    }
    public static RuleType getFlowTypeByName(String name) {
        for (RuleType ruleType : RuleType.values()) {
            if (ruleType.getName()
                    .equals(name)) {
                return ruleType;
            }
        }
        return null;
    }
}
